package g

import (
	"reflect"
	"testing"
)

func Test_diameterOfBinaryTree(t *testing.T) {
	type args struct {
		root *TreeNode
	}
	tests := []struct {
		name string
		args args
		want int
	}{
		{"1", args{GetTreeNode([]int{1, null, 2, 3})}, 2},
		{"2", args{GetTreeNode([]int{})}, 0},
		{"3", args{GetTreeNode([]int{1, 2, 3, 4, 5, null, null, 6, null, null, 8, null, 7, null, 9})}, 6},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := diameterOfBinaryTree(tt.args.root); !reflect.DeepEqual(got, tt.want) {
				t.Errorf("%v inorderTraversal() = %v, want %v", tt.name, got, tt.want)
			}
		})
	}
}
